package com.fy.fyspace.model.vo.user;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Data
@ApiModel(description = "用户统计信息")
public class UserStatisticsVO implements Serializable {

    @ApiModelProperty("图片统计")
    private PictureStatistics pictureStatistics;

    @ApiModelProperty("空间统计")
    private SpaceStatistics spaceStatistics;

    @ApiModelProperty("活动统计")
    private ActivityStatistics activityStatistics;

    @ApiModelProperty("文件类型统计")
    private FileTypeStatistics fileTypeStatistics;

    @Data
    public static class PictureStatistics {
        @ApiModelProperty("总图片数量")
        private Long totalCount;

        @ApiModelProperty("总图片大小(字节)")
        private Long totalSize;

        @ApiModelProperty("图片格式分布")
        private Map<String, Long> formatDistribution;

        @ApiModelProperty("图片分类分布")
        private Map<String, Long> categoryDistribution;

        @ApiModelProperty("热门标签(标签及其使用次数)")
        private Map<String, Long> popularTags;

        @ApiModelProperty("待审核图片数量")
        private Long reviewingCount;

        @ApiModelProperty("已通过图片数量")
        private Long approvedCount;

        @ApiModelProperty("已拒绝图片数量")
        private Long rejectedCount;
    }

    @Data
    public static class SpaceStatistics {
        @ApiModelProperty("空间使用率(0-100)")
        private Double usageRate;

        @ApiModelProperty("空间等级")
        private String spaceLevel;

        @ApiModelProperty("空间创建时间")
        private Date createTime;

        @ApiModelProperty("总空间大小(字节)")
        private Long maxSize;

        @ApiModelProperty("已用空间大小(字节)")
        private Long usedSize;

        @ApiModelProperty("剩余空间大小(字节)")
        private Long remainingSize;

        @ApiModelProperty("最大图片数量限制")
        private Long maxCount;

        @ApiModelProperty("剩余可上传数量")
        private Long remainingCount;
    }

    @Data
    public static class ActivityStatistics {
        @ApiModelProperty("最近上传的图片(最多5张)")
        private List<RecentPicture> recentPictures;

        @ApiModelProperty("最常使用的分类(最多5个)")
        private List<CategoryUsage> topCategories;

        @ApiModelProperty("最常使用的标签(最多10个)")
        private List<TagUsage> topTags;
    }

    @Data
    public static class RecentPicture {
        private Long id;
        private String name;
        private String url;
        private String thumbnailUrl;
        private Date uploadTime;
    }

    @Data
    public static class CategoryUsage {
        private String category;
        private Long count;
    }

    @Data
    public static class TagUsage {
        private String tag;
        private Long count;
    }

    @Data
    public static class FileTypeStatistics {
        @ApiModelProperty("文件类型分布")
        private Map<String, Long> typeDistribution;

        @ApiModelProperty("总文件数")
        private Long totalFiles;
    }

    private static final long serialVersionUID = 1L;
}